#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <functional>
#include <queue>
#include <stdio.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#ifndef TEST
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> piii;

// fast input
inline ll read() {
    ll X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch))
        X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}

// fast output
inline void write(ll x) {
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}

#define pb push_back
#define mp make_pair

void solve() {
    string s;
    cin >> s;
    int n = s.length();
    vector<int> pres(n + 1);
    pres[0] = 0;
    for (int i = 1; i <= n; i++) {
        if (s[i - 1] == '+') {
            pres[i] = pres[i - 1] + 1;
        } else {
            pres[i] = pres[i - 1] - 1;
        }
    }
    ll ans = 0;
    for (int l = 1; l <= n; l++) {
        int sum = 0;
        int cnt = 0;
        for (int r = l; r <= n; r++) {
            if (s[r - 1] == '+') {
                sum++;
            } else {
                sum--;
            }
            if (sum == 0) {
                cnt++;
            } else if (sum < 0) {
                break;
            }
        }
        ans += cnt;
    }
    write(ans);
    putchar('\n');
}

int32_t main() {
    int t = 1;
    while (t--) {
        solve();
    }
}